package com.m.ioc.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
public class BeanConfig {
//    @Primary
    @Bean({"u1","uu"})
    public UserInfo userInfo() {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(1);
        userInfo.setAge(18);
        userInfo.setName("lisi");
        return userInfo;
    }

    @Bean
    public String name() {
        return "wangwu";
    }

//    @Bean
//    public UserInfo userInfo2(String name) {
//        UserInfo userInfo = new UserInfo();
//        userInfo.setId(2);
//        userInfo.setAge(18);
//        userInfo.setName(name);
//        return userInfo;
//    }
@Bean("u2")
public UserInfo userInfo2(String name) {
    UserInfo userInfo = new UserInfo();
    userInfo.setId(2);
    userInfo.setAge(18);
    userInfo.setName(name);
    return userInfo;
}
}
